<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Jedrzej\Pimpable\PimpableTrait;


class SystemNotice extends Model

{
    use HasFactory;
    use PimpableTrait;
    use SoftDeletes;

    /**
     *可批量赋值的字段
     */
    public $fillable = [
        'push_admin',
        'title',
        'type',
        'icon',
        'url',
        'table_title',
        'template',
        'status',
    ];


    /**
     * 可搜索的字段
     */
    public $searchable = [
        'title',
        'type',
        'use_time',
        'table_title',
        'template',
    ];


    /**
     * 默认倒序排序
     */
    protected $defaultSortCriteria = ['id,desc'];


    /**
     * 优惠券发放所关联的用户
     */
    public function system(){
        return $this->hasMany(SystemAdmin::class,'push_admin','id');
    }
}
